package com.kornero.auto.util.data;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public abstract class FileManager {

    private static final Logger logger = LoggerFactory.getLogger(FileManager.class);

    public static List<String> readFileLines(final String file) {
        logger.debug("readFileLines(): file = {}", file);
        final List<String> strings = new ArrayList<>(100);
        try (final BufferedReader reader = new BufferedReader(new FileReader(new File(file)))) {
            String line;
            while (null != (line = reader.readLine())) {
                if (!line.isEmpty()) {
                    strings.add(line);
                }
            }
        } catch (IOException e) {
            logger.error("readFileLines(): ", e);
        }
        return strings;
    }
}
